﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace cuyan.resume.analysis.Utlis
{

    public static class StringHelp
    {
        public static int GetStrShowCount(this string str, string str01)
        {
            int count = 0; //计数器
            string search = str01; //要查的字符串
            for (int i = 0; i < str.Length - search.Length; i++)
            {
                if (str.Substring(i, search.Length) == search)
                {
                    count++;
                }
            }

            return count;
        }
        public static string PPGO(this string str, string str01)
        {
            var resultstr = "";
            var strArray = str01.Split('\u002C');
            foreach (var item in strArray)
            {
                if (str == item.Split(':')[0])
                {
                    resultstr = item.Split(':')[1];
                };
            }

            return resultstr;
        }


        public static string ToLine(this string str)
        {
            string resultstr = "";  //目标字符串
            for (int j = 0; j < str.Length; j++)  //strItem是原始字符串
            {
                string temp = str[j].ToString();
                if (Regex.IsMatch(temp, "[A-Z]"))
                {
                    temp = "_" + temp.ToLower();
                }
                resultstr += temp;
            }
            return resultstr;
        }
    }
}
